package com.ayf.payment.game.api.eqb.service;

import com.alibaba.fastjson.JSONObject;
import com.ayf.payment.game.api.eqb.exception.DefineException;
import com.ayf.payment.game.api.eqb.helper.FileTemplateHelper;
import com.swwx.charm.commons.lang.utils.LogPortal;

import java.io.IOException;

/**
 * @Description:
 * @Author: zh-liang
 * @Date : 2020-06-17 15:21
 */
public class EQBMain {
    public static void main(String[] args) throws DefineException, IOException {
        String filePath = "files/个人协议2020.06.16.pdf";


        LogPortal.info("---------------------通过上传方式创建模板start-----------------------------");
        JSONObject uploadTemJson = FileTemplateHelper.createTemplateByUpload(filePath, "测试协议.pdf");
        String templateId = uploadTemJson.getString("templateId");
        String uploadUrl = uploadTemJson.getString("uploadUrl");

        LogPortal.info("---------------------文件流上传文件start---------------------------------");
        FileTemplateHelper.streamUpload(filePath, uploadUrl);

        System.out.println(templateId);
    }
}
